<?php

namespace app\admin\controller;

use think\facade\Request;
use app\common\Common;
use app\admin\service\VideoTemplateService;
use app\common\StsService;

class VideoTemplate extends Base
{
    private $service;

    public function __construct(VideoTemplateService $service)
    {
        parent::__construct();
        $this->service = $service;
    }

    // 渲染短剧列表
    public function index()
    {
        return view();
    }

    // 渲染短剧详情
    public function info()
    {
        return view();
    }

    /**
     * 短剧分组列表
     */
    public function list()
    {
        $params = Request::param();

        $data = $this->service->getList($params);

        return Common::success($data);
    }

    /**
     * 添加短剧分组
     */
    public function add()
    {
        $params = Request::param();

        $result = $this->service->editVideoTemplate($params, $this->getUserInfo());

        if (!$result) {
            return Common::fail();
        }

        return Common::success();
    }

    /**
     * 编辑短剧分组
     */
    public function edit()
    {
        $params = Request::param();
        $result = $this->service->editVideoTemplate($params, $this->getUserInfo());

        if (!$result) {
            return Common::fail();
        }

        return Common::success();
    }

    // 短剧分组详情
    public function detail()
    {
        $params = Request::param();

        $data = $this->service->getVideoDetail($params);
        if (!$data) {
            return Common::fail();
        }
        return Common::success($data);
    }

    /**
     * 删除视频分组
     */
    public function delete()
    {
        $params = Request::param();
        $result = $this->service->deleteVideoTemplate($params);

        if (!$result) {
            return Common::fail();
        }

        return Common::success();
    }

    // 短剧下拉列表
    public function select()
    {
        $params = Request::param();
        $data = $this->service->getVideoTemplateSelectList($params);

        return Common::success($data);
    }

    
}